using System;
using System.Collections.Generic;
using System.IO;
using System.Linq.Expressions;
using System.Windows.Media;

namespace 修为尽失.辅助.Resources
{
     public static class ResManager
    {
        public static KeyValuePair<string, string[]> Mspaint = new KeyValuePair<string, string[]>(Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\mspaint.exe", new[] {"画图", "Microsoft Corporation"});
        public static string 当前用户HKEY_USER_Subkey =>SystemHelper.f_取得当前用户HKEY_USER_Subkey();
        public static Dictionary<string, string[]> ValidMuiCacheDictionary =>SystemHelper.GetValidMuiCacheDictionary();
        public static Dictionary<string, Dictionary<string, string[]>> _预先加载的常见图片打开方式集合 = SystemHelper.f_加载文件打开方式子菜单集合数据();
        public static class Fonts
        {
            private static readonly TryExpression TryCatch微软雅黑 = Expression.TryCatch(Expression.Block(Expression.Constant(new GlyphTypeface(new Uri(Environment.GetFolderPath(Environment.SpecialFolder.Fonts) + "\\simhei.ttf", UriKind.Absolute)))), Expression.Catch(typeof(SystemException), Expression.Constant(new GlyphTypeface())));
            public static Typeface 微软雅黑_ = new Typeface("微软雅黑");
            public static Typeface 仿宋 = new Typeface("仿宋");
            public static GlyphTypeface 微软雅黑 => Expression.Lambda<Func<GlyphTypeface>>(TryCatch微软雅黑).Compile()();
            public static GlyphTypeface Consola => new GlyphTypeface(new Uri(Environment.GetFolderPath(Environment.SpecialFolder.Fonts) + "\\consola.ttf", UriKind.Absolute));
        }
        public static class Paths
        {
            public const string innerdir = "pack://application:,,,/效果图项目管理器;component/";
            public static string temp = Path.Combine(Environment.GetEnvironmentVariable("TEMP") ?? Tempb, "效果图项目库临时目录");
            private const string Tempb = "c://tempb";

            public static void VerifyDirectory(string dir)
            {
                if (Directory.Exists(dir) == false)
                    Directory.CreateDirectory(dir);
            }

            public static void VerifyTemp()
            {
                VerifyDirectory(temp);
            }

            public static void CleanDirectory(string dir)
            {
                if (!Directory.Exists(dir))
                    return;
                if (Directory.GetFileSystemEntries(dir).Length == 0)
                    return;
                try
                {
                    Directory.Delete(dir, true);
                    VerifyDirectory(dir);
                }
                catch (Exception e)
                {
                    e.ShowException();
                }
                finally
                {
                    CleanDirectory(dir);
                }
            }

            public static void CleanTemp()
            {
                CleanDirectory(temp);
            }
        }

        public static class Strings
        {
            public const string Windows常见图像文件过滤后缀名 = "常见图像(*.bmp;*.jpg;*.jpeg;*.gif;*.png)|*.bmp;*.jpg;*.jpeg;*.gif;*.png|联合图像专家组图像(*.jpg;*.jpeg)|*.jpg;*.jpeg|可移植网络图形(*.png)|*.png|图形交换格式(*.gif)|*.gif|位图(*.bmp)|*.bmp|标记图像文件(*.tiff)|*.tiff|Windows 图元文件(*.wmf)|*.wmf|增强型图元文件(*.emf)|*.emf";
            public static string[] 常见图像文件后缀名匹配数组 = {"*.jpg", "*.jpeg", "*.png", "*.gif", "*.bmp"};

            public static readonly string[] Windows常见图像文件过滤后缀名数组 =
            {
                ".bmp", ".gif", ".jpg", ".jpeg", ".png", ".ico"
            };

            public static readonly string[] Windows常见图像文件过滤后缀名数组附加集 =
            {
                ".tiff", ".svg", ".emf", ".wmf", ".ai", ".psd", ".cdr", ".pcx", ".tga", ".tif", ".dds", ".eps", ".pld", ".hdp", ".pdn", ".xcf", ".cpt", ".ufo", ".", ".afphoto", ".dpp", ".svgz", ".fh11", ".fh10", ".xar", ".webp"
            };
            
            
            public static readonly string[] DBTextSeperator = {"^;"};
            public static readonly string[] DBUriTextWithSpecSeperator = {"^:", "^;"};
            public const string DTffffff = "yyyy-MM-dd HH:mm:ss.ffffff";
            public const string DTfff = "yyyy-MM-dd HH:mm:ss.fff";
            public const string DT = "yyyy-MM-dd HH:mm:ss";
            public const string BaolongIP = "192.168.10.102";
            
            
        }

        public static class Images
        {
           
        }
        
    }
}